<script setup lang='ts'>
// import ScreenIllness from "@/components/Screen-Illness/index.vue";
import { PureTableBar } from "@/components/RePureTableBar";
import WashFinance from "@/components/WashFinance/index.vue";
import { useWashTacticsCenter } from "./hooks/WashTacticsCenter";

const {
  form,
  rules,
  Refform,
  loading,
  columns,
  dataList,
  btnloading,
  pagination,
  updateTitle,
  DecisionList2,
  CreditVisible,
  hanStop,
  hanRedact,
  stubim_form,
  CloseVisible,
  handleSizeChange,
  handleCurrentChange
} = useWashTacticsCenter('1')
</script>

<template>
  <div class="main">
    <PureTableBar class="list_hei" title="策略列表">
      <template #buttons>
        <el-button type="primary" @click="hanRedact(undefined)"> 添加 </el-button>
      </template>
      <template v-slot="{ size, checkList }">
        <pure-table border align-whole="center" showOverflowTooltip table-layout="auto" :loading="loading" size="small"
          :data="dataList" :columns="columns" :checkList="checkList" :pagination="pagination" max-height="650"
          @size-change="handleSizeChange" @current-change="handleCurrentChange" :header-cell-style="{
            background: 'var(--el-table-row-hover-bg-color)',
            color: 'var(--el-text-color-primary)'
          }">
          <template #operation="{ row }">
            <el-button type='primary' size="small" :disabled="row.state == 1" text @click="hanRedact(row)">
              编辑
            </el-button>
            <!-- <el-popconfirm :title="`是否确认${row.state == 1 ? '暂停' : '开启'}?`" @confirm="hanStop(row)">
              <template #reference>
                <el-button type='primary' size="small" text>
                  {{ row.state == 1 ? "暂停" : "开启" }}
                </el-button>
              </template>
            </el-popconfirm> -->

          </template>
        </pure-table>
      </template>
    </PureTableBar>

    <ReDialog :width="800" :height="550" :models="CreditVisible" @Closes="CloseVisible(Refform)">
      <template #header>
        <h2 style="text-align: center;">{{ updateTitle }}策略</h2>
      </template>
      <template #main>
        <el-scrollbar height="460px">
          <el-form ref="Refform" :model="form" label-width="90px" :rules="rules">
            <el-form-item label="策略名称" prop="strategyName">
              <el-input v-model="form.strategyName" class="!w-[220px]" />
            </el-form-item>
            <el-form-item label="风险等级" prop="riskLevel">
              <el-select v-model="form.riskLevel" class="!w-[220px]">
                <el-option label="低风险" value="低风险" />
                <el-option label="中风险" value="中风险" />
                <el-option label="高风险" value="高风险" />
              </el-select>
            </el-form-item>
            <el-form-item label="策略条件">
              <WashFinance :btnstate="false" :rowdata="form.customerScreening" />
            </el-form-item>
            <el-form-item label="策略决策" prop="decision">
              <el-checkbox-group v-model="form.decision">
                <el-checkbox v-for="t in DecisionList2" :key="t.label" :label="t.label">{{
                  t.label
                }}</el-checkbox>
              </el-checkbox-group>
            </el-form-item>
          </el-form>
        </el-scrollbar>
      </template>
      <template #footer>
        <el-button type="primary" @click="stubim_form(Refform)" :loading="btnloading">确定</el-button>
        <el-button @click="CloseVisible(Refform)"> 取消 </el-button>
      </template>
    </ReDialog>
  </div>
</template>

<style scoped lang="scss">
@import url(@/style/CreditComm.scss);

:deep(.list_hei.p-2) {
  padding: 0;
}

:deep(.list_hei.mt-6) {
  margin: 0;
}

:deep(#choose) {
  width: 100%;
  background-color: white;
  padding: 0;
}

:deep(.el-checkbox-group) {
  text-align: left;
}

:deep(.el-dialog__footer) {
  text-align: center;
}
</style>
